package main

import "fmt"

func main() {
	s := " Hello World    "
	word := lengthOfLastWord(s)
	fmt.Println(word)
}

func lengthOfLastWord(s string) int {
	size := 0
	for i := len(s) - 1; i >= 0; i-- {
		if s[i] != ' ' {
			size++
		} else if size > 0 {
			return size
		}
	}
	return size

}
